{% extends 'partial/layout.njk' %}

{% block body %}
  <header class='demos-header'>
    <a href="/">
      <h1 class="demos-title">
         我的任务
      </h1>
    </a>
  </header>

  <div class="bd">
    <div class="page__bd">

      {% if not taskList[0].id %}
        <p class="demos-sub-title">
          啊哦，好像还没有作业呢！
        </p>
      {% endif %}

      <div class="weui-panel__bd">
        {% set taskPrev = taskList[0] %}

        {%for task in taskList %}

          {% if loop.first %}
            <div class="weui-media-box weui-media-box_text">
              <h4 class="weui-media-box__title">{{ task.title }}</h4>
              <a href="/page/taskReviewReview?id={{task.id}}&fromPage=taskMineList&field=date">
                {% if task.serveMemberName %}
                <p class="weui-media-box__desc">服侍对象：{{ task.serveMemberName }}</p>
                {% endif %}
                 {% if task.category == "每日汇报" %}
                <p class="weui-media-box__desc">任务内容：{{ task.assignment }}</p>
                {% endif %}
                <p class="weui-media-box__desc">{{task.content | safe}}</p>
              {% endif %}

              {% if task.id != taskPrev.id %}

              </a>
              <ul class="weui-media-box__info">
                <li class="weui-media-box__info__meta">{{taskPrev.date}}</li>
                <li class="weui-media-box__info__meta weui-media-box__info__meta_extra">{{taskPrev.category}}</li>
              </ul>
            </div>

            <div class="weui-media-box weui-media-box_text">
              <h4 class="weui-media-box__title">{{ task.title }}</h4>
              <a href="/page/taskReviewReview?id={{task.id}}&fromPage=taskMineList&field=date">
                {% if task.serveMemberName %}
                <p class="weui-media-box__desc">服侍对象：{{ task.serveMemberName }}</p>
                {% endif %}
                 {% if task.category == "每日汇报" %}
                <p class="weui-media-box__desc">任务内容：{{ task.assignment }}</p>
                {% endif %}
                <p class="weui-media-box__desc">{{task.content |  safe}}</p>
                {% set taskPrev = task %}
              {% endif %}

              {% if task.comment%}
                <p class="weui-media-box__desc review-text">
                  【{{task.commenterNetName}}
                  {{task.commenterPosition}}】：{{task.comment}}</p>
              {% endif %}

              {% if loop.last %}
              </a>
              <ul class="weui-media-box__info">
                <li class="weui-media-box__info__meta">{{task.date}}</li>
                <li class="weui-media-box__info__meta weui-media-box__info__meta_extra">{{task.category}}</li>
              </ul>
            </div>
          {% if status == "others" %}
          <div class="weui-btn-area">
            <a href="/page/taskMemberList" class="weui-btn weui-btn_default">返回成员列表</a>
          </div>
          {% endif %}

          {% endif %}

        {% endfor %}

      </div>

    </div>
  </div>

  <style>
    .review-text {
      color: #3cc51f;
    }
    .weui-media-box__desc {
      -webkit-line-clamp: unset;
      margin-bottom: 8px;
    }
  </style>

  {% endblock%}